home *** CD-ROM | disk | FTP | other *** search
open in:
MacOS 8.1
|
Win98
|
DOS
browse contents |
view JSON data
|
view as text
This file was processed as: LaTeX Document
(document/latex).
Confidence | Program | Detection | Match Type | Support
|
---|
100%
| dexvert
| LaTeX Document (document/latex)
| magic
| Supported |
1%
| dexvert
| NWiper Show (other/nWiperShow)
| ext
| Unsupported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| LaTeX document, ASCII text, with CR line terminators
| default
| |
100%
| checkBytes
| Printable ASCII
| default
| |
100%
| perlTextCheck
| Likely Text (Perl)
| default
| |
100%
| siegfried
| fmt/281 LaTeX (Subdocument)
| default
| |
100%
| detectItEasy
| Format: plain text[CR]
| default (weak)
|
|
id metadata |
---|
key | value |
---|
macFileType | [TEXT] |
macFileCreator | [MPS ] |
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 25 20 43 6f 70 79 72 69 | 67 68 74 20 31 39 39 31 |% Copyri|ght 1991|
|00000010| 20 62 79 20 4e 6f 72 6d | 61 6e 20 52 61 6d 73 65 | by Norm|an Ramse|
|00000020| 79 2e 20 20 41 6c 6c 20 | 72 69 67 68 74 73 20 72 |y. All |rights r|
|00000030| 65 73 65 72 76 65 64 2e | 0d 25 20 53 65 65 20 66 |eserved.|.% See f|
|00000040| 69 6c 65 20 43 4f 50 59 | 52 49 47 48 54 20 66 6f |ile COPY|RIGHT fo|
|00000050| 72 20 6d 6f 72 65 20 69 | 6e 66 6f 72 6d 61 74 69 |r more i|nformati|
|00000060| 6f 6e 2e 0d 40 20 0d 5c | 73 65 63 74 69 6f 6e 7b |on..@ .\|section{|
|00000070| 55 74 69 6c 69 74 79 20 | 66 75 6e 63 74 69 6f 6e |Utility |function|
|00000080| 73 7d 0d 0d 5c 73 75 62 | 73 65 63 74 69 6f 6e 7b |s}..\sub|section{|
|00000090| 4c 69 6e 65 2d 6f 72 69 | 65 6e 74 65 64 20 69 6e |Line-ori|ented in|
|000000a0| 70 75 74 7d 0d 5b 5b 67 | 65 74 6c 69 6e 65 5d 5d |put}.[[g|etline]]|
|000000b0| 20 69 73 20 72 65 61 64 | 73 20 69 6e 20 74 68 65 | is read|s in the|
|000000c0| 20 6e 65 78 74 20 6c 69 | 6e 65 2c 20 6e 6f 20 6d | next li|ne, no m|
|000000d0| 61 74 74 65 72 0d 68 6f | 77 20 6c 6f 6e 67 20 69 |atter.ho|w long i|
|000000e0| 74 20 69 73 2c 20 65 78 | 70 61 6e 64 69 6e 67 20 |t is, ex|panding |
|000000f0| 74 61 62 73 2e 0d 49 20 | 61 6c 6c 6f 63 61 74 65 |tabs..I |allocate|
|00000100| 20 6d 6f 72 65 20 61 6e | 64 20 6d 6f 72 65 20 73 | more an|d more s|
|00000110| 70 61 63 65 20 66 6f 72 | 20 74 68 65 20 6c 69 6e |pace for| the lin|
|00000120| 65 2c 20 75 6e 74 69 6c | 20 49 27 76 65 0d 72 65 |e, until| I've.re|
|00000130| 61 64 20 61 20 77 68 6f | 6c 65 20 6c 69 6e 65 20 |ad a who|le line |
|00000140| 6f 72 20 75 6e 74 69 6c | 20 49 20 72 75 6e 20 6f |or until| I run o|
|00000150| 75 74 20 6f 66 20 73 70 | 61 63 65 2c 20 77 68 69 |ut of sp|ace, whi|
|00000160| 63 68 65 76 65 72 20 63 | 6f 6d 65 73 20 66 69 72 |chever c|omes fir|
|00000170| 73 74 2e 0d 54 68 65 20 | 62 75 66 66 65 72 20 67 |st..The |buffer g|
|00000180| 72 6f 77 73 20 69 6e 20 | 73 69 7a 65 20 65 78 70 |rows in |size exp|
|00000190| 6f 6e 65 6e 74 69 61 6c | 6c 79 2c 20 73 6f 20 74 |onential|ly, so t|
|000001a0| 68 65 20 63 6f 73 74 20 | 69 6e 20 6f 76 65 72 68 |he cost |in overh|
|000001b0| 65 61 64 20 69 73 20 72 | 6f 75 67 68 6c 79 20 74 |ead is r|oughly t|
|000001c0| 68 65 20 6c 6f 67 61 72 | 69 74 68 6d 0d 6f 66 20 |he logar|ithm.of |
|000001d0| 74 68 65 20 6c 65 6e 67 | 74 68 20 6f 66 20 74 68 |the leng|th of th|
|000001e0| 65 20 6c 6f 6e 67 65 73 | 74 20 6c 69 6e 65 2e 0d |e longes|t line..|
|000001f0| 40 0d 5b 5b 67 65 74 6c | 69 6e 65 5d 5d 20 72 65 |@.[[getl|ine]] re|
|00000200| 75 73 65 73 20 74 68 65 | 20 73 61 6d 65 20 69 6e |uses the| same in|
|00000210| 74 65 72 6e 61 6c 20 62 | 75 66 66 65 72 73 20 6f |ternal b|uffers o|
|00000220| 76 65 72 20 61 6e 64 20 | 6f 76 65 72 2c 20 73 6f |ver and |over, so|
|00000230| 20 73 75 62 73 65 71 75 | 65 6e 74 0d 63 61 6c 6c | subsequ|ent.call|
|00000240| 73 20 64 65 73 74 72 6f | 79 20 74 68 65 20 72 65 |s destro|y the re|
|00000250| 73 75 6c 74 73 20 6f 66 | 20 70 72 65 76 69 6f 75 |sults of| previou|
|00000260| 73 20 63 61 6c 6c 73 2e | 0d 3c 3c 2a 3e 3e 3d 0d |s calls.|.<<*>>=.|
|00000270| 23 64 65 66 69 6e 65 20 | 53 54 41 52 54 5f 53 49 |#define |START_SI|
|00000280| 5a 45 20 31 32 38 09 09 | 09 2f 2a 20 69 6e 69 74 |ZE 128..|./* init|
|00000290| 69 61 6c 20 62 75 66 66 | 65 72 20 73 69 7a 65 20 |ial buff|er size |
|000002a0| 2a 2f 0d 0d 23 69 6e 63 | 6c 75 64 65 20 3c 73 74 |*/..#inc|lude <st|
|000002b0| 64 69 6f 2e 68 3e 0d 23 | 69 6e 63 6c 75 64 65 20 |dio.h>.#|include |
|000002c0| 3c 73 74 72 69 6e 67 2e | 68 3e 0d 23 69 6e 63 6c |<string.|h>.#incl|
|000002d0| 75 64 65 20 3c 73 74 64 | 6c 69 62 2e 68 3e 0d 23 |ude <std|lib.h>.#|
|000002e0| 69 6e 63 6c 75 64 65 20 | 22 63 6f 6c 75 6d 6e 73 |include |"columns|
|000002f0| 2e 68 22 0d 23 69 6e 63 | 6c 75 64 65 20 22 65 72 |.h".#inc|lude "er|
|00000300| 72 6f 72 73 2e 68 22 0d | 23 69 6e 63 6c 75 64 65 |rors.h".|#include|
|00000310| 20 22 67 65 74 6c 69 6e | 65 2e 68 22 0d 0d 73 74 | "getlin|e.h"..st|
|00000320| 61 74 69 63 20 63 68 61 | 72 20 2a 62 75 66 31 20 |atic cha|r *buf1 |
|00000330| 3d 20 4e 55 4c 4c 2c 20 | 2a 62 75 66 32 20 3d 20 |= NULL, |*buf2 = |
|00000340| 4e 55 4c 4c 3b 09 2f 2a | 20 6c 69 6e 65 73 20 77 |NULL;./*| lines w|
|00000350| 69 74 68 6f 75 74 2c 20 | 77 69 74 68 20 74 61 62 |ithout, |with tab|
|00000360| 73 20 65 78 70 61 6e 64 | 65 64 20 2a 2f 0d 73 74 |s expand|ed */.st|
|00000370| 61 74 69 63 20 62 75 66 | 5f 73 69 7a 65 20 3d 20 |atic buf|_size = |
|00000380| 53 54 41 52 54 5f 53 49 | 5a 45 3b 09 09 2f 2a 20 |START_SI|ZE;../* |
|00000390| 73 69 7a 65 20 6f 66 20 | 62 6f 74 68 20 62 75 66 |size of |both buf|
|000003a0| 66 65 72 73 20 69 66 20 | 6e 6f 6e 2d 4e 55 4c 4c |fers if |non-NULL|
|000003b0| 20 2a 2f 0d 0d 3c 3c 43 | 20 66 75 6e 63 74 69 6f | */..<<C| functio|
|000003c0| 6e 73 3e 3e 0d 40 20 25 | 64 65 66 20 53 54 41 52 |ns>>.@ %|def STAR|
|000003d0| 54 5f 53 49 5a 45 20 62 | 75 66 5f 73 69 7a 65 20 |T_SIZE b|uf_size |
|000003e0| 62 75 66 31 20 62 75 66 | 32 0d 3c 3c 68 65 61 64 |buf1 buf|2.<<head|
|000003f0| 65 72 3e 3e 3d 0d 63 68 | 61 72 20 2a 67 65 74 6c |er>>=.ch|ar *getl|
|00000400| 69 6e 65 5f 65 78 70 61 | 6e 64 20 28 46 49 4c 45 |ine_expa|nd (FILE|
|00000410| 20 2a 66 70 29 3b 0d 20 | 20 2f 2a 20 67 72 61 62 | *fp);. | /* grab|
|00000420| 20 61 20 6c 69 6e 65 20 | 69 6e 20 62 75 66 66 65 | a line |in buffe|
|00000430| 72 2c 20 72 65 74 75 72 | 6e 20 6e 65 77 20 62 75 |r, retur|n new bu|
|00000440| 66 66 65 72 20 6f 72 20 | 4e 55 4c 4c 20 66 6f 72 |ffer or |NULL for|
|00000450| 20 65 6f 66 0d 20 20 20 | 20 20 74 61 62 73 20 69 | eof. | tabs i|
|00000460| 6e 20 6c 69 6e 65 20 61 | 72 65 20 65 78 70 61 6e |n line a|re expan|
|00000470| 64 65 64 20 61 63 63 6f | 72 64 69 6e 67 20 74 6f |ded acco|rding to|
|00000480| 20 74 61 62 73 69 7a 65 | 20 2a 2f 0d 63 68 61 72 | tabsize| */.char|
|00000490| 20 2a 67 65 74 6c 69 6e | 65 20 28 46 49 4c 45 20 | *getlin|e (FILE |
|000004a0| 2a 66 70 29 3b 0d 20 20 | 2f 2a 20 67 72 61 62 20 |*fp);. |/* grab |
|000004b0| 61 20 6c 69 6e 65 20 69 | 6e 20 74 68 65 20 62 75 |a line i|n the bu|
|000004c0| 66 66 65 72 2c 20 72 65 | 74 75 72 6e 20 61 20 6e |ffer, re|turn a n|
|000004d0| 65 77 20 62 75 66 66 65 | 72 20 6f 72 20 4e 55 4c |ew buffe|r or NUL|
|000004e0| 4c 20 66 6f 72 20 65 6f | 66 0d 20 20 20 20 20 6e |L for eo|f. n|
|000004f0| 6f 20 65 78 70 61 6e 73 | 69 6f 6e 20 6f 66 20 74 |o expans|ion of t|
|00000500| 61 62 73 20 2a 2f 0d 40 | 0d 3c 3c 43 20 66 75 6e |abs */.@|.<<C fun|
|00000510| 63 74 69 6f 6e 73 3e 3e | 3d 0d 76 6f 69 64 20 6e |ctions>>|=.void n|
|00000520| 65 77 5f 62 75 66 66 65 | 72 73 28 76 6f 69 64 29 |ew_buffe|rs(void)|
|00000530| 20 7b 0d 20 20 20 20 63 | 68 65 63 6b 70 74 72 28 | {. c|heckptr(|
|00000540| 62 75 66 31 20 3d 20 28 | 63 68 61 72 20 2a 29 20 |buf1 = (|char *) |
|00000550| 72 65 61 6c 6c 6f 63 28 | 62 75 66 31 2c 20 62 75 |realloc(|buf1, bu|
|00000560| 66 5f 73 69 7a 65 29 29 | 3b 0d 20 20 20 20 63 68 |f_size))|;. ch|
|00000570| 65 63 6b 70 74 72 28 62 | 75 66 32 20 3d 20 28 63 |eckptr(b|uf2 = (c|
|00000580| 68 61 72 20 2a 29 20 72 | 65 61 6c 6c 6f 63 28 62 |har *) r|ealloc(b|
|00000590| 75 66 32 2c 20 62 75 66 | 5f 73 69 7a 65 29 29 3b |uf2, buf|_size));|
|000005a0| 0d 7d 0d 3c 3c 43 20 66 | 75 6e 63 74 69 6f 6e 73 |.}.<<C f|unctions|
|000005b0| 3e 3e 3d 0d 63 68 61 72 | 20 2a 67 65 74 6c 69 6e |>>=.char| *getlin|
|000005c0| 65 20 28 46 49 4c 45 20 | 2a 66 70 29 20 7b 0d 0d |e (FILE |*fp) {..|
|000005d0| 20 20 20 20 3c 3c 69 66 | 20 5b 5b 62 75 66 31 3d | <<if| [[buf1=|
|000005e0| 3d 4e 55 4c 4c 5d 5d 2c | 20 61 6c 6c 6f 63 61 74 |=NULL]],| allocat|
|000005f0| 65 20 69 6e 69 74 69 61 | 6c 20 62 75 66 66 65 72 |e initia|l buffer|
|00000600| 73 3e 3e 0d 20 20 20 20 | 0d 20 20 20 20 62 75 66 |s>>. |. buf|
|00000610| 31 3d 66 67 65 74 73 28 | 62 75 66 31 2c 20 62 75 |1=fgets(|buf1, bu|
|00000620| 66 5f 73 69 7a 65 2c 20 | 66 70 29 3b 0d 20 20 20 |f_size, |fp);. |
|00000630| 20 69 66 20 28 62 75 66 | 31 3d 3d 4e 55 4c 4c 29 | if (buf|1==NULL)|
|00000640| 20 72 65 74 75 72 6e 20 | 62 75 66 31 3b 20 2f 2a | return |buf1; /*|
|00000650| 20 65 6e 64 20 6f 66 20 | 66 69 6c 65 20 2a 2f 0d | end of |file */.|
|00000660| 20 20 20 20 77 68 69 6c | 65 20 28 62 75 66 31 5b | whil|e (buf1[|
|00000670| 73 74 72 6c 65 6e 28 62 | 75 66 31 29 2d 31 5d 20 |strlen(b|uf1)-1] |
|00000680| 21 3d 20 27 5c 6e 27 29 | 20 7b 20 2f 2a 20 66 61 |!= '\n')| { /* fa|
|00000690| 69 6c 65 64 20 74 6f 20 | 67 65 74 20 77 68 6f 6c |iled to |get whol|
|000006a0| 65 20 6c 69 6e 65 20 2a | 2f 0d 09 62 75 66 5f 73 |e line *|/..buf_s|
|000006b0| 69 7a 65 20 2a 3d 20 32 | 3b 0d 09 6e 65 77 5f 62 |ize *= 2|;..new_b|
|000006c0| 75 66 66 65 72 73 28 29 | 3b 0d 09 69 66 20 28 66 |uffers()|;..if (f|
|000006d0| 67 65 74 73 28 62 75 66 | 31 2b 73 74 72 6c 65 6e |gets(buf|1+strlen|
|000006e0| 28 62 75 66 31 29 2c 62 | 75 66 5f 73 69 7a 65 2d |(buf1),b|uf_size-|
|000006f0| 73 74 72 6c 65 6e 28 62 | 75 66 31 29 2c 66 70 29 |strlen(b|uf1),fp)|
|00000700| 3d 3d 4e 55 4c 4c 29 0d | 09 20 20 20 20 72 65 74 |==NULL).|. ret|
|00000710| 75 72 6e 20 62 75 66 31 | 3b 20 2f 2a 20 65 6e 64 |urn buf1|; /* end|
|00000720| 20 6f 66 20 66 69 6c 65 | 20 2a 2f 0d 20 20 20 20 | of file| */. |
|00000730| 7d 0d 20 20 20 20 72 65 | 74 75 72 6e 20 62 75 66 |}. re|turn buf|
|00000740| 31 3b 0d 7d 0d 40 20 25 | 64 65 66 20 67 65 74 6c |1;.}.@ %|def getl|
|00000750| 69 6e 65 0d 3c 3c 43 20 | 66 75 6e 63 74 69 6f 6e |ine.<<C |function|
|00000760| 73 3e 3e 3d 0d 63 68 61 | 72 20 2a 67 65 74 6c 69 |s>>=.cha|r *getli|
|00000770| 6e 65 5f 65 78 70 61 6e | 64 20 28 46 49 4c 45 20 |ne_expan|d (FILE |
|00000780| 2a 66 70 29 20 7b 0d 20 | 20 20 20 63 68 61 72 20 |*fp) {. | char |
|00000790| 2a 73 2c 20 2a 74 3b 0d | 20 20 20 20 69 6e 74 20 |*s, *t;.| int |
|000007a0| 77 69 64 74 68 3b 0d 0d | 20 20 20 20 69 66 20 28 |width;..| if (|
|000007b0| 67 65 74 6c 69 6e 65 28 | 66 70 29 3d 3d 4e 55 4c |getline(|fp)==NUL|
|000007c0| 4c 29 20 72 65 74 75 72 | 6e 20 4e 55 4c 4c 3b 0d |L) retur|n NULL;.|
|000007d0| 20 20 20 20 3c 3c 69 66 | 20 5b 5b 63 6f 6c 75 6d | <<if| [[colum|
|000007e0| 6e 77 69 64 74 68 28 62 | 75 66 31 29 20 3e 20 62 |nwidth(b|uf1) > b|
|000007f0| 75 66 5f 73 69 7a 65 20 | 2d 20 31 5d 5d 2c 20 61 |uf_size |- 1]], a|
|00000800| 6c 6c 6f 63 61 74 65 20 | 6e 65 77 20 62 75 66 66 |llocate |new buff|
|00000810| 65 72 73 3e 3e 0d 20 20 | 20 20 73 20 3d 20 62 75 |ers>>. | s = bu|
|00000820| 66 31 3b 20 74 20 3d 20 | 62 75 66 32 3b 20 77 69 |f1; t = |buf2; wi|
|00000830| 64 74 68 3d 30 3b 0d 20 | 20 20 20 77 68 69 6c 65 |dth=0;. | while|
|00000840| 20 28 2a 73 29 0d 09 69 | 66 20 28 2a 73 3d 3d 27 | (*s)..i|f (*s=='|
|00000850| 5c 74 27 20 26 26 20 74 | 61 62 73 69 7a 65 20 3e |\t' && t|absize >|
|00000860| 20 30 29 20 7b 0d 09 20 | 20 20 20 64 6f 20 7b 0d | 0) {.. | do {.|
|00000870| 09 09 2a 74 2b 2b 20 3d | 20 27 20 27 3b 20 77 69 |..*t++ =| ' '; wi|
|00000880| 64 74 68 2b 2b 3b 0d 09 | 20 20 20 20 7d 20 77 68 |dth++;..| } wh|
|00000890| 69 6c 65 20 28 77 69 64 | 74 68 20 25 20 74 61 62 |ile (wid|th % tab|
|000008a0| 73 69 7a 65 20 21 3d 20 | 30 29 3b 0d 09 20 20 20 |size != |0);.. |
|000008b0| 20 73 2b 2b 3b 0d 09 7d | 20 65 6c 73 65 20 69 66 | s++;..}| else if|
|000008c0| 20 28 2a 73 20 3d 3d 20 | 28 63 68 61 72 29 20 30 | (*s == |(char) 0|
|000008d0| 78 43 41 29 20 7b 0d 09 | 20 20 20 20 2a 74 2b 2b |xCA) {..| *t++|
|000008e0| 20 3d 20 27 20 27 3b 20 | 2b 2b 73 3b 20 77 69 64 | = ' '; |++s; wid|
|000008f0| 74 68 2b 2b 3b 0d 09 7d | 20 65 6c 73 65 20 7b 0d |th++;..}| else {.|
|00000900| 09 20 20 20 20 2a 74 2b | 2b 20 3d 20 2a 73 2b 2b |. *t+|+ = *s++|
|00000910| 3b 20 77 69 64 74 68 2b | 2b 3b 0d 09 7d 0d 20 20 |; width+|+;..}. |
|00000920| 20 20 2a 74 3d 27 5c 30 | 27 3b 0d 20 20 20 20 72 | *t='\0|';. r|
|00000930| 65 74 75 72 6e 20 62 75 | 66 32 3b 0d 7d 0d 40 20 |eturn bu|f2;.}.@ |
|00000940| 25 64 65 66 20 67 65 74 | 6c 69 6e 65 5f 65 78 70 |%def get|line_exp|
|00000950| 61 6e 64 0d 3c 3c 69 66 | 20 5b 5b 62 75 66 31 3d |and.<<if| [[buf1=|
|00000960| 3d 4e 55 4c 4c 5d 5d 2c | 20 61 6c 6c 6f 63 61 74 |=NULL]],| allocat|
|00000970| 65 20 69 6e 69 74 69 61 | 6c 20 62 75 66 66 65 72 |e initia|l buffer|
|00000980| 73 3e 3e 3d 0d 69 66 20 | 28 62 75 66 31 3d 3d 4e |s>>=.if |(buf1==N|
|00000990| 55 4c 4c 29 20 7b 0d 20 | 20 20 20 63 68 65 63 6b |ULL) {. | check|
|000009a0| 70 74 72 28 62 75 66 31 | 20 3d 20 28 63 68 61 72 |ptr(buf1| = (char|
|000009b0| 20 2a 29 20 6d 61 6c 6c | 6f 63 20 28 62 75 66 5f | *) mall|oc (buf_|
|000009c0| 73 69 7a 65 29 29 3b 0d | 20 20 20 20 63 68 65 63 |size));.| chec|
|000009d0| 6b 70 74 72 28 62 75 66 | 32 20 3d 20 28 63 68 61 |kptr(buf|2 = (cha|
|000009e0| 72 20 2a 29 20 6d 61 6c | 6c 6f 63 20 28 62 75 66 |r *) mal|loc (buf|
|000009f0| 5f 73 69 7a 65 29 29 3b | 0d 7d 0d 3c 3c 69 66 20 |_size));|.}.<<if |
|00000a00| 5b 5b 63 6f 6c 75 6d 6e | 77 69 64 74 68 28 62 75 |[[column|width(bu|
|00000a10| 66 31 29 20 3e 20 62 75 | 66 5f 73 69 7a 65 20 2d |f1) > bu|f_size -|
|00000a20| 20 31 5d 5d 2c 20 61 6c | 6c 6f 63 61 74 65 20 6e | 1]], al|locate n|
|00000a30| 65 77 20 62 75 66 66 65 | 72 73 3e 3e 3d 0d 69 66 |ew buffe|rs>>=.if|
|00000a40| 20 28 63 6f 6c 75 6d 6e | 77 69 64 74 68 28 62 75 | (column|width(bu|
|00000a50| 66 31 29 20 3e 20 62 75 | 66 5f 73 69 7a 65 20 2d |f1) > bu|f_size -|
|00000a60| 20 31 29 20 7b 0d 20 20 | 20 20 77 68 69 6c 65 20 | 1) {. | while |
|00000a70| 28 63 6f 6c 75 6d 6e 77 | 69 64 74 68 28 62 75 66 |(columnw|idth(buf|
|00000a80| 31 29 20 3e 20 62 75 66 | 5f 73 69 7a 65 20 2d 20 |1) > buf|_size - |
|00000a90| 31 29 20 62 75 66 5f 73 | 69 7a 65 20 2a 3d 20 32 |1) buf_s|ize *= 2|
|00000aa0| 3b 0d 20 20 20 20 6e 65 | 77 5f 62 75 66 66 65 72 |;. ne|w_buffer|
|00000ab0| 73 28 29 3b 0d 7d 0d | |s();.}. | |
+--------+-------------------------+-------------------------+--------+--------+